package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchFlowDataRecords;
import com.ruoyi.system.service.IDispatchFlowDataRecordsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 流量数据记录Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchFlowDataRecords")
public class DispatchFlowDataRecordsController extends BaseController
{
    @Autowired
    private IDispatchFlowDataRecordsService dispatchFlowDataRecordsService;

    /**
     * 查询流量数据记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchFlowDataRecords:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchFlowDataRecords dispatchFlowDataRecords)
    {
        startPage();
        List<DispatchFlowDataRecords> list = dispatchFlowDataRecordsService.selectDispatchFlowDataRecordsList(dispatchFlowDataRecords);
        return getDataTable(list);
    }

    /**
     * 导出流量数据记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchFlowDataRecords:export')")
    @Log(title = "流量数据记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchFlowDataRecords dispatchFlowDataRecords)
    {
        List<DispatchFlowDataRecords> list = dispatchFlowDataRecordsService.selectDispatchFlowDataRecordsList(dispatchFlowDataRecords);
        ExcelUtil<DispatchFlowDataRecords> util = new ExcelUtil<DispatchFlowDataRecords>(DispatchFlowDataRecords.class);
        util.exportExcel(response, list, "流量数据记录数据");
    }

    /**
     * 获取流量数据记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchFlowDataRecords:query')")
    @GetMapping(value = "/{flowDataRecordsId}")
    public AjaxResult getInfo(@PathVariable("flowDataRecordsId") Long flowDataRecordsId)
    {
        return success(dispatchFlowDataRecordsService.selectDispatchFlowDataRecordsByFlowDataRecordsId(flowDataRecordsId));
    }

    /**
     * 新增流量数据记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchFlowDataRecords:add')")
    @Log(title = "流量数据记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchFlowDataRecords dispatchFlowDataRecords)
    {
        return toAjax(dispatchFlowDataRecordsService.insertDispatchFlowDataRecords(dispatchFlowDataRecords));
    }

    /**
     * 修改流量数据记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchFlowDataRecords:edit')")
    @Log(title = "流量数据记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchFlowDataRecords dispatchFlowDataRecords)
    {
        return toAjax(dispatchFlowDataRecordsService.updateDispatchFlowDataRecords(dispatchFlowDataRecords));
    }

    /**
     * 删除流量数据记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchFlowDataRecords:remove')")
    @Log(title = "流量数据记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{flowDataRecordsIds}")
    public AjaxResult remove(@PathVariable Long[] flowDataRecordsIds)
    {
        return toAjax(dispatchFlowDataRecordsService.deleteDispatchFlowDataRecordsByFlowDataRecordsIds(flowDataRecordsIds));
    }
}
